package com.woniuxy.common.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    /**
     * OaCorsFilter 过滤器交给spring管理
     * 设置过滤器优先顺序，拦截路径
     * @return
     */
    @Bean
    public FilterRegistrationBean myFilterRegistrationBean() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new OaCorsFilter());
        //添加过滤路径
        filterRegistrationBean.addUrlPatterns("/*");
        //设置过滤器的顺序
        filterRegistrationBean.setOrder(Integer.MIN_VALUE);
        return filterRegistrationBean;
    }


}
